SHELL=/bin/sh

CC=gcc
LD=ld
CFLAGS = -g -W -Wall -Winline -O2
INCLUDE="-I/vol/java-1.5.0/include -I/vol/java-1.5.0/include/solaris"
#INCLUDE=-I/opt/sun-jdk-1.5.0.11/include -I/opt/sun-jdk-1.5.0.11/include/linux
OBJS=qsufsort.o qsufsort_wrap.o qsufsort_impl.o

.PHONY: all
all : libqsufsort.so

# algorithm by larsson and sadakane
libqsufsort.so: $(OBJS)
	$(LD) -G qsufsort.o qsufsort_wrap.o qsufsort_impl.o -o libqsufsort.so

qsufsort_wrap.c: qsufsort.i
	swig -java -package de.unibi.comet.qsufsort -outdir de/unibi/comet/qsufsort qsufsort.i

# pattern rule for all objects files
%.o: %.c
	$(CC) -c $(CFLAGS) $(INCLUDE) $< -o $@

clean:
	rm -f $(OBJS) qsufsort_wrap.c libqsufsort.so

